<?php
	//les fonctions
	function player_exist($pseudo){
		return mysql_num_rows(mysql_query("SELECT * FROM players 
WHERE pseudo = '".$pseudo."'"));
	}
	function create_player($login,$pass){
		$passmd5 = md5($pass);
		mysql_query("INSERT INTO players (pseudo,password) 
VALUES ('".$login."','".$passmd5."')") or die ('Erreur : 
'.mysql_error());
	}
	function check_player_name($pseudo){
		if ( mysql_num_rows(mysql_query("SELECT * FROM players 
WHERE pseudo = '".$pseudo."'")) >=1){
			return true;
		}
		else{
			return false;
		}	
	}
	function check_password($login,$pass){
		$query = mysql_query("SELECT password FROM players WHERE 
pseudo = '".$pseudo."'");
		while ($query2 = mysql_fetch_array($query)){
			if (md5($query2['password'])==$pass){
				return true;
			}
			else
				return false;
		}
	}
?>
